package homeWork.five.demo0;
import java.util.Random;
public class TestDemo1 {
    //生成一个包含六个字符的随机验证码，每个字符的取值范围是0~9 a~z A~Z
    public static void main(String[] args) {
        Random random = new Random();
        StringBuilder captcha = new StringBuilder();
        for(int i =0;i<6;++i){
            int form = random.nextInt(3);//生成三种形式
            if(form==0){
                //大写字母A~Z
                captcha.append((char) (random.nextInt(26) + 'A'));
            }else if(form==1){
                //小写字母a~z
                captcha.append((char)(random.nextInt(26) + 'a'));
            }else {
                //数字0~9
                captcha.append(random.nextInt(10));
            }
        }
        //生成验证码
        System.out.println(captcha);
    }
}